<?php

require_once 'config.php';

require_once 'includes/functions.php';

// 如果已登录，直接跳转到后台

if (isLoggedIn()) {

    redirect('admin.php');

}

?>

<?php include 'includes/header.php'; ?>

<div class="login-container">

    <h2 style="text-align: center; margin-bottom: 30px;">管理员登录</h2>

    

    <?php if (isset($_SESSION['error'])): ?>

        <div class="alert alert-error">

            <?php echo $_SESSION['error']; unset($_SESSION['error']); ?>

        </div>

    <?php endif; ?>

    

    <form action="action/login.php" method="POST">

        <div class="form-group">

            <label for="username">用户名:</label>

            <input type="text" id="username" name="username" class="form-control" required>

        </div>

        

        <div class="form-group">

            <label for="password">密码:</label>

            <input type="password" id="password" name="password" class="form-control" required>

        </div>

        

        <button type="submit" class="btn" style="width: 100%;">登录</button>

    </form>

    

    <div style="margin-top: 20px; text-align: center; font-size: 12px; color: #666;">


    </div>

</div>

<?php include 'includes/footer.php'; ?>